package tests;

import common.Utils;
import org.openqa.selenium.By;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 */
public class HomePage extends Utils {
    public static String url = "http://49.235.61.184:8080/home";

    public HomePage() {
        super(url);
    }
    /**
     * 检查页面元素
     * 注意：先要确保用户登录
     */
    public void checkHomePageRight() throws IOException {

        //检查“我的考试”按钮
        driver.findElement(By.cssSelector("#rc-tabs-0-tab-exam"));
        //检查“我的问卷”按钮
        driver.findElement(By.cssSelector("#rc-tabs-0-tab-survey"));
        //检查“问卷记录”按钮
        driver.findElement(By.cssSelector("#rc-tabs-0-tab-surveyHistory"));
        //检查“考试记录”按钮
        driver.findElement(By.cssSelector("#rc-tabs-0-tab-examHistory"));
        //检查问卷数
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div.extraContent___3rMo7 > div:nth-child(1) > div > div.ant-statistic-title"));
        //检查考试数
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-ghost > div.ant-page-header-content > div > div > div > div > div > div.extraContent___3rMo7 > div:nth-child(2) > div > div.ant-statistic-title"));
        //检查“创建问卷”按钮
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(1)"));
        //检查“创建考试”按钮
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-col.ant-col-xs-24.ant-col-sm-24.ant-col-md-24.ant-col-lg-24.ant-col-xl-8 > div > div.ant-card-body > div > a:nth-child(2)"));

        //屏幕截图
        ScreenShot(Thread.currentThread().getStackTrace()[1].getMethodName());
    }
}
